
<template>
  <div class="card" style="padding:10px;width:50%" >
    <div style="font-weight: bold; font-size: 24px; margin-left: 10px">我的信息</div>
  </div>
  <div class="card" style="padding:10px;width:50%" >
    <el-form :model="data.form" label-width="120px">
      <el-form-item label="学号">
        <el-input v-model="data.form.id" autocomplete="off" />
      </el-form-item>
      <el-form-item label="姓名">
        <el-input v-model="data.form.username" autocomplete="off" />
      </el-form-item>
      <el-form-item label="Mbti类型">
        <el-input v-model="data.form.mbti" autocomplete="off" />
      </el-form-item>
      <el-form-item label="学院">
        <el-input v-model="data.form.college" autocomplete="off" />
      </el-form-item>
      <el-form-item label="专业">
        <el-input v-model="data.form.speciality" autocomplete="off" />
      </el-form-item>
      <el-form-item label="班级">
        <el-input v-model="data.form.classes" autocomplete="off" />
      </el-form-item>
      <el-form-item label="测试时间">
        <el-input v-model="data.form.time" autocomplete="off" />
      </el-form-item>
    </el-form>
  </div>

</template>

<script setup>
import request from "@/utils/request";
import {reactive} from "vue";

const data = reactive({
  form: {},
  id: JSON.parse(localStorage.getItem('student-user') || "")
})
const handleSearch = () =>{
  request.get('/result/userStudent',
      {
        params: {
          id: data.id
        }
      }).then(res => {
    console.log(res.data[0])
    data.form = res.data[0]
  }).catch(error => {
    console.error('Error fetching data:', error); // 输出错误信息
  });
}
//调用方法获取后台数据
handleSearch()


</script>